﻿
<common:LayoutAwarePage
    x:Name="pageRoot"

    x:Class="Dynamics_AX_System_Administrator_Center.ItemsPage"
    DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Dynamics_AX_System_Administrator_Center"
    xmlns:data="using:Dynamics_AX_System_Administrator_Center.Data"
    xmlns:common="using:Dynamics_AX_System_Administrator_Center.Common"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
	
	

    <common:LayoutAwarePage.Resources>

    	<ResourceDictionary>

    		<!-- Collection of items displayed by this page -->
    		<CollectionViewSource
    			x:Name="itemsViewSource"
    			Source="{Binding Items}"
    			d:Source="{Binding AllGroups, Source={d:DesignInstance IsDesignTimeCreatable=True, Type=data:SampleDataSource}}"/>
    		<Storyboard x:Name="ApprovalCenterStoryBoard"/>
    		<Style x:Key="ButtonStyle1" TargetType="Button">
    			<Setter Property="Template">
    				<Setter.Value>
    					<ControlTemplate TargetType="Button">
    						<Grid>
    							<VisualStateManager.VisualStateGroups>
    								<VisualStateGroup x:Name="CommonStates">
    									<VisualState x:Name="Pressed"/>
    									<VisualState x:Name="Disabled"/>
    									<VisualState x:Name="PointerOver"/>
    								</VisualStateGroup>
    								<VisualStateGroup x:Name="FocusStates">
    									<VisualState x:Name="Focused"/>
    									<VisualState x:Name="PointerFocused"/>
    								</VisualStateGroup>
    							</VisualStateManager.VisualStateGroups>
    							<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="1200,25,30,23" Content="Test AX Connection" Width="136"/>
    						</Grid>
    					</ControlTemplate>
    				</Setter.Value>
    			</Setter>
    		</Style>
    	</ResourceDictionary>
</common:LayoutAwarePage.Resources>
	

    <!--
        This grid acts as a root panel for the page that defines two rows:
        * Row 0 contains the back button and page title
        * Row 1 contains the rest of the page layout
    -->
    <Grid Style="{StaticResource LayoutRootStyle}">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition Width="1366*"/>
    		<ColumnDefinition/>
    	</Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="768"/>  
           
        </Grid.RowDefinitions>

        <!-- Horizontal scrolling grid used in most view states -->
        <GridView
            x:Name="itemGridView"
            AutomationProperties.AutomationId="ItemsGridView"
            AutomationProperties.Name="Items"
            TabIndex="1"
            Padding="116,136,116,46"
            ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
            ItemTemplate="{StaticResource Standard250x250ItemTemplate}"
            SelectionMode="None"
            IsSwipeEnabled="false"
            IsItemClickEnabled="True"
            ItemClick="ItemView_ItemClick" Margin="10,-10,-10,10" Grid.ColumnSpan="2" Foreground="{x:Null}" CanReorderItems="True" FontSize="12" CanDragItems="True"/>

        <!-- Vertical scrolling list only used when snapped -->
        <ListView
            x:Name="itemListView"
            AutomationProperties.AutomationId="ItemsListView"
            AutomationProperties.Name="Items"
            TabIndex="1"
            Visibility="Collapsed"
            Margin="0,130,0,0"
            Padding="10,0,0,60"
            ItemsSource="{Binding Source={StaticResource itemsViewSource}}"
            ItemTemplate="{StaticResource Standard80ItemTemplate}"
            SelectionMode="None"
            IsSwipeEnabled="false"
            IsItemClickEnabled="True"
            ItemClick="ItemView_ItemClick" Grid.ColumnSpan="2"/>

        <!-- Back button and page title -->
        <Grid Grid.ColumnSpan="2" HorizontalAlignment="left" Width="1366" Margin="0,0,0,628">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Button x:Name="backButton" Click="GoBack" IsEnabled="{Binding Frame.CanGoBack, ElementName=pageRoot}" Style="{StaticResource BackButtonStyle}"/>
            <TextBlock x:Name="pageTitle" Text="Dynamics AX Administrator Center" IsHitTestVisible="false" Style="{StaticResource PageHeaderTextStyle}" Margin="210,0,-10,50"/>
            <Image Margin="84,13,0,0" Source="Assets/DynamicsLogo.PNG" Stretch="Fill" Width="100" Height="91" HorizontalAlignment="Left" VerticalAlignment="Top"/>
        </Grid>
		<AppBar x:Name ="BottomAppBar1"
		Padding="10,0,10,0"
		AutomationProperties.Name="Bottom App Bar" Grid.Column="1" Margin="521,-10,-2439,10"> 
        		<Grid>
        			<Grid.ColumnDefinitions>
        				<ColumnDefinition Width ="50*"/>
        				<ColumnDefinition Width ="50*"/>
        			</Grid.ColumnDefinitions>
        			<StackPanel Orientation="Horizontal"/>
        			<StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal"/>
        		</Grid>
        	</AppBar>
	
		
		
        


        <VisualStateManager.VisualStateGroups>

            <!-- Visual states reflect the application's view state -->
            <VisualStateGroup x:Name="ApplicationViewStates">
                <VisualState x:Name="FullScreenLandscape"/>
                <VisualState x:Name="Filled"/>

                <!-- The entire page respects the narrower 100-pixel margin convention for portrait -->
                <VisualState x:Name="FullScreenPortrait">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource PortraitBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Padding">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="96,136,86,56"/>
                        </ObjectAnimationUsingKeyFrames>
                    </Storyboard>
                </VisualState>

                <!--
                    The back button and title have different styles when snapped, and the list representation is substituted
                    for the grid displayed in all other view states
                -->
                <VisualState x:Name="Snapped">
                    <Storyboard>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backButton" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedBackButtonStyle}"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="pageTitle" Storyboard.TargetProperty="Style">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource SnappedPageHeaderTextStyle}"/>
                        </ObjectAnimationUsingKeyFrames>

                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemListView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Visible"/>
                        </ObjectAnimationUsingKeyFrames>
                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="itemGridView" Storyboard.TargetProperty="Visibility">
                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>
                        </ObjectAnimationUsingKeyFrames>

                    </Storyboard>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>
    </Grid>
</common:LayoutAwarePage>



